#!/usr/bin/env python
# -*- coding: utf8 -*-
# Filename: script\split_negative_example.py
# Author: xul - 294739212@qq.com
# Description: 
# Create: 2017-03-12 20:39:38

import collections
import random

d = collections.defaultdict(list)
for line in open('../data/test_n.txt'):
    line_list = line.split('\t:\t')
    d[line_list[0]].append(line)

f_write = open('../data/test_n.txt', 'w')
f_write1 = open('../data/test_n1.txt', 'w')

for type_, lines in d.iteritems():
    length = len(lines)
    # float_num = random.random()
    for line in lines:
        if length % 2:
            f_write.write(line) 
        else:
            f_write1.write(line)
        length -= 1

f_write.close()
f_write1.close()
